﻿
namespace MoreEPG.Model
{
    /// <summary>
    /// A class to represent a traditional TV Channel
    /// </summary>
    public class TVChannel
    {
        /// <summary>
        /// A unique ID for each channel.  This is what is output into the MXF.
        /// </summary>
        public int id_ {get;set;}

        /// <summary>
        /// The string that represents the channel in the smltv file
        /// </summary>
        public string searchString_ { get; set; }

        /// <summary>
        /// The name of the channel
        /// </summary>
        public string name_ { get; set; }

        /// <summary>
        /// to Match the Scanned Channel in MC
        /// </summary>
        public string MatchName { get; set; }

        /// <summary>
        /// Media Center Channel Callsign
        /// </summary>
        public string MCSender { get; set; }

        /// <summary>
        /// URL ID for the logo for the channel
        /// </summary>
        public string logoUrlID { get; set; }

        /// <summary>
        /// Path for the logo for the channel (usually c:\\something )
        /// </summary>
        public string logoUrl { get; set; }

        /// <summary>
        /// Indicates if TVChannel is HDTV
        /// </summary>
        public bool isHDTV { get; set; }

        /// <summary>
        /// Constructor for the channel class
        /// </summary>
        /// <param name="id">Unique ID for the channel</param>
        /// <param name="name">The name of the channel</param>
        /// <param name="searchString">The string that represents the channel in the xmltv file</param>
        public TVChannel(int id, string name, string searchString)
        {
            id_ = id;
            name_ = name;
            searchString_ = searchString;
        }

        /// <summary>
        /// Get the id of the channel
        /// </summary>
        /// <returns>A string s#, to represent the channel</returns>
        public string id()
        {
            return "s" + id_.ToString();
        }

        /// <summary>
        /// Get the service uid for the channel in MXF format
        /// </summary>
        /// <returns>String in format "!Service!uid"</returns>
        public string uid()
        {
            return "!Service!" + callsign();
        }

        /// <summary>
        /// Get the channel UID for MXF file
        /// </summary>
        /// <returns>String in format "!Channel!uid"</returns>
        public string channelUID()
        {
            return "!Channel!" + MoreEPG.Properties.Settings.Default.ProviderString + "!" + id_.ToString();
        }

        /// <summary>
        /// Get the callsign (name) of the channel for the MXF file
        /// </summary>
        /// <returns>String: name in uppercase</returns>
        public string callsign()
        {
            return searchString_.ToUpper();
        }

        /// <summary>
        /// Get whom the provider of the channel is.  W7MCE suffixes the channel listing name with this.
        /// </summary>
        /// <returns>String in "!Affiliate!provider" format</returns>
        public string affiliate()
        {
            return "!Affiliate!" + MoreEPG.Properties.Settings.Default.ProviderString;
        }

        /// <summary>
        /// Get an identifier the logo for the channel for display in the guide
        /// </summary>
        /// <returns>String in format "!Image!name"</returns>
        public string logoUID()
        {
            return "!Image!Z" + callsign();
        }

        /// <summary>
        /// Get an id the logo for the channel for display in the guide
        /// </summary>
        /// <returns>String in format "i#"</returns>
        public string logoID()
        {
            return "i" + id_.ToString();
        }


    }
}
